package com.um2.simplexe.client.plugin.test;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import com.um2.simplexe.client.ui.exec.ToutesLesMethodesClient;

public class fenetreContact extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public fenetreContact(final ToutesLesMethodesClient tlmc) {
		super("contact") ;
		
		setLayout(new BorderLayout()) ;
		final JTextArea jta1 = new JTextArea("message envoi") ;
		final JTextArea jta2 = new JTextArea("reception ...") ;
		jta2.setEditable(false) ;
		
		JPanel pBas = new JPanel(new FlowLayout()) ;
		final JTextField jtf1 = new JTextField("CODE") ;
		JButton jb1 = new JButton("envoyer") ;
		pBas.add(jtf1) ;
		pBas.add(jb1) ;
		
		add(jta1,BorderLayout.NORTH) ;
		add(jta2,BorderLayout.CENTER) ;
		add(pBas,BorderLayout.SOUTH) ;
		
		jb1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				jta2.setText(tlmc.envoyerMessage(jtf1.getText()+"\n"+jta1.getText())) ;
			}}) ;
	
		setSize(500,400) ;
		setVisible(true) ;
	}

}
